<?
require_once("../config/dbconn.php");require_once("../config/powercls.php");

if($act=='fahuo'){
	$msg='';
	if(trim($sjname)=='') $msg="请输入收件人\\n";
	if(trim($sjaddress)=='') $msg="请输入收件地址\\n";
	if(trim($contact)=='') $msg="请输入联系电话\\n";
	if(trim($wlgs)=='') $msg="请输入物流公司\\n";
	if(trim($wlno)=='') $msg="请输入物流单号\\n";
	if ($msg!=''){
		echo "<script>alert('$msg');history.back();</script>";exit();
	}
	//更新数据库
	$dataArray['sjname']=trim($sjname);
	$dataArray['sjaddress']=trim($sjaddress);
	$dataArray['contact']=trim($contact);
	$dataArray['wlgs']=trim($wlgs);
	$dataArray['wlno']=trim($wlno);
	$dataArray['state']=2;
	$dataArray['fhtime']=$curtime;
	$dataArray['memo']=addslashes($memo);
	$condition="id='$id'";
	$db->update("{$db_prefix}orders",$dataArray,$condition);
	
	echo "<script>alert('订单已经发货\\n\\n！');location.href='order_lst2.php';</script>";exit();
}

//获取订单及其会员的信息

$sql1="select * from {$db_prefix}orders where id='$id'";
$rs1=$db->get_one($sql1);

$sqlhy="select * from {$db_prefix}users where username='".$rs1['username']."'";
$rshy=$db->get_one($sqlhy);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	
}
.red{
	color:red
}
-->
</style>

<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td width="935" height="29" valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">已支付订单发货</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top">
		<form id="form1" name="form1" method="post" action="?act=fahuo">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="3"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                <tr>
                  <td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td height="30" colspan="3">
			  
			  <table width="100%" height="240" border="0" cellpadding="0" cellspacing="0">
                <!--<tr>
                  <td height="30" align="center" class="left_txt">订单编号</td>
                  <td height="30" class="left_txt"><?=$rs1['id']?></td>
                </tr>-->
                <tr>
                  <td height="30" align="center" class="left_txt">订购会员</td>
                  <td height="30" class="left_txt"><?=$rs1['username']?></td>
                </tr>
                 <tr>
                  <td height="30" align="center" class="left_txt">所属专卖店</td>
                  <td height="30" class="left_txt"><?=$rs1['zmduser']?></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">收件人姓名</td>
                  <td height="30" class="left_txt"><label>
                    <input name="sjname" type="text" id="sjname" value="<?=$rshy['nickname']?>">
                    <span class="red">*</span></label></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">收件地址</td>
                  <td height="30" class="left_txt"><label>
                    <input name="sjaddress" type="text" id="sjaddress" size="50" value="<?=$rshy['address']?>">
                    <span class="red">*</span></label></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">联系电话（很重要）</td>
                  <td height="30" class="left_txt"><label>
                    <input name="contact" type="text" id="contact" size="40" value="<?=$rshy['mobile']?>">
                    <span class="red">*</span></label></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">物流公司</td>
                  <td height="30" class="left_txt"><select name="wlgs" id="wlgs">
				  <option value=''>请选择物流公司</option>
				  <?
				  $sqlgs="select * from {$db_prefix}wuliu where 1";
				  $resultgs=$db->query($sqlgs);
				  while($rsgs=$db->fetch_array($resultgs)){
				  	echo "<option value='{$rsgs['gsname']}'>{$rsgs['gsname']}</option>";
				  }
				  $db->free_result($resultgs);
				  ?>
                  </select> 
                    <span class="red">*  </span></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">物流单号</td>
                  <td height="30" class="left_txt"><input name="wlno" type="text" id="wlno" size="40" />
                    <span class="red">*</span></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">备注</td>
                  <td height="30" class="left_txt"><label>
                    <textarea name="memo" cols="40" rows="6" id="memo"></textarea>
                  </label></td>
                  </tr>
              </table></td>
            </tr>
            
            <tr>
              <td height="30" colspan="3">&nbsp;</td>
            </tr>
            <tr>
              <td width="50%" height="30" align="right"><input name="id" type="hidden" id="id" value="<?=$id?>">
              <input name="pageno" type="hidden" id="pageno" value="<?=$pageno?>">
<input type="submit" value="确定发货" name="B1" /></td>
              <td width="6%" height="30" align="right">&nbsp;</td>
              <td width="44%" height="30"><input type="reset" value="取消设置" name="B12" /></td>
            </tr>
            <tr>
              <td height="30" colspan="3">&nbsp;</td>
            </tr>
          </table>
		  </form>
		  </td>
      </tr>
    </table></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
      <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>

</body>
</html>
